package com.linoer.cloud.alo.common.aspect.demo;

import com.linoer.cloud.alo.common.aspect.proxy.AfterAdvice;
import com.linoer.cloud.alo.common.aspect.proxy.BeforeAdvice;
import com.linoer.cloud.alo.common.aspect.proxy.ExceptionAdvice;
import com.linoer.cloud.alo.common.aspect.proxy.jdk.ProxyFactory;

/**
 * @Classname StudentTest
 * @Description TODO
 * @Date 2021/7/27 4:38 下午
 * @Created by muhenglv
 */
public class StudentTest {
    public static void main(String[] args) {
        Student student = new Student("TOM");

        // JDK动态代理
        Object proxy = ProxyFactory.getProxyInstance(student,
                (BeforeAdvice) () -> System.out.println("before"),
                (AfterAdvice) () -> System.out.println("after"),
                (ExceptionAdvice) () -> System.out.println("exception"));
        ((People) proxy).learn();
    }
}
